<template>
  <div class="payBox">
    <div class="price">
      <span>支付金额：</span>
      <nut-price
        :price="confirmData.payAmount"
        size="normal"
        position="after"
        symbol="元"
      />
    </div>
    <nut-radio-group v-model="payData.payType" text-position="left">
      <nut-radio label="1">
        <img src="@/assets/pay/wechat.png" alt="" />
        <span>微信</span>
        <template #icon> <Checked color="#aaa" /> </template>
        <template #checkedIcon> <Checked color="red" /> </template>
      </nut-radio>
      <nut-radio label="2">
        <img src="@/assets/pay/alipay.png" alt="" />
        <span>支付宝</span>
        <template #icon> <Checked color="#aaa" /> </template>
        <template #checkedIcon> <Checked color="red" /> </template>
      </nut-radio>
    </nut-radio-group>
    <nut-button
      type="primary"
      :loading="loading"
      :disabled="loading"
      @click="emits('pay', payData.payType)"
      >确认支付</nut-button
    >
  </div>
</template>

<script setup>
import { Checked } from "@nutui/icons-vue";
import { reactive, defineProps, defineEmits } from "vue";

// 支付方式
const payData = reactive({
  payType: "2",
});

// 属性
const props = defineProps({
  confirmData: {
    type: Object,
  },
  loading: {
    type: Boolean,
  },
});

// 方法
const emits = defineEmits(["pay"]);
</script>

<style lang="less" scoped>
.payBox {
  // padding: 30px 25px;
  .price {
    margin-bottom: 25px;
  }
  .nut-radio-group {
    width: 100%;
    margin-bottom: 30px;
    .nut-radio {
      display: flex;
      justify-content: flex-start;
      margin-bottom: 20px;
      :deep(.nut-radio__label) {
        display: flex;
        align-items: center;
        img {
          width: 20px;
          height: 20px;
        }
        span {
          margin-left: 10px;
          font-size: 13px;
        }
      }
    }
  }
  .nut-button {
    width: 100%;
    border-radius: 10px;
  }
  a {
    display: flex;
    width: 100%;
    height: 35px;
    background: red;
    border-radius: 10px;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    color: #fff;
    font-size: 14px;
  }
}
</style>